//
//  CYGPushManager.m
//  RACSample
//
//  Created by jinchu01 on 2017/5/25.
//  Copyright © 2017年 tinpay. All rights reserved.
//

#import "CYGPushManager.h"

@implementation CYGPushManager

// 增加当前badge数
+ (void)incBadgeNumber {
    [UIApplication sharedApplication].applicationIconBadgeNumber += 1;
}

// 减少当前badge数
+ (void)decBadgeNumber {
    [UIApplication sharedApplication].applicationIconBadgeNumber -= 1;
}

// 0 表示不显示
+ (void)setBadgeNumber:(NSInteger)num {
    [UIApplication sharedApplication].applicationIconBadgeNumber = num;
}

+ (void)registerPush {
    UIUserNotificationSettings *s = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge categories:nil];
    [[UIApplication sharedApplication] registerUserNotificationSettings:s];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
}

+ (void)registerFailWithError:(NSError *)err {
    
}

+ (void)handleDeviceToken:(NSData *)token {
    NSString *tokenStr = [[[[token description] stringByReplacingOccurrencesOfString:@"<" withString:@""] stringByReplacingOccurrencesOfString:@">" withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""];
}

+ (void)receiveRemoteNotificationWithUserInfo:(NSDictionary *)userInfo
                                    fromState:(ReceivedNotifState)state {
    
}

@end
